package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class GoodsDownListener {
    @Autowired
    private ESManagerService esManagerService;

    /**
     * 监听消息队列,接收上架后的后的spuId
     */
    @RabbitListener(queues = RabbitMQConfig.SEARCH_DEL_QUEUE)
    public void receiveMesage(String spuId) {
        System.out.println("接收到的消息为:" + spuId);

        //查询skuList,并导入索引库
        esManagerService.delDataBySpuId(spuId);
    }
}
